<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加评论</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/assets/layui-v2.5.5/css/layui.css" media="all" />
</head>
<body>
<div class="layui-fluid" style="margin-top:2%;">
		<form class="layui-form" action="" id="myForm">
		<div class="layui-form-item">
		    <label class="layui-form-label">评价<font color="#FF0000">*</font></label>
		    <div class="layui-input-block">
		      <input type="text" name="commentValue" lay-verify="required" autocomplete="off" placeholder="请输入评价内容" class="layui-input">
		    </div>
		  </div>
		  <div class="layui-form-item">
				<div class="layui-input-block" style="text-align: center;margin:0 auto;">
					<button class="layui-btn" lay-submit="" lay-filter="submit-comment">保存</button> 
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>  
		</form>
	</div>
<script src="/assets/layui-v2.5.5/layui.js" charset="utf-8"></script> 
<script>
var $,id,form;
	layui.use(['form','jquery'], function(){
	  form = layui.form;
	  $=layui.$;
	  id='#(id)';
		form.on('submit(submit-comment)', function(obj){
			commentSave(obj.field);
			return false;
			});
	});
function commentSave(params){
	params.id=id;
	$.ajax({
	    url : '/teacher/commentSave',
		type : "post",
		data : params,
		dataType : "json",
		success : function(ret) {
			if (ret.state == 'ok') {
				layer.msg(ret.msg, {icon: 1, offset: '15px', time: 600}, function(){
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
					parent.$(".layui-laypage-btn").click();
				});
			} else {
				layer.msg(ret.msg, {icon: 2, offset: '10px'});
			}
		},
		error: function() {
      } 
  });
}
</script> 
</body>
</html>